<template>
	<view class="box">
		<view class="eqBox" @click="scanFun">
			<u-image :src="require('../../static/scan.png')" width="168rpx" height="168rpx"></u-image>
			<view class="scan">扫一扫</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {

			}
		},
		methods: {
			//调起二维码
			scanFun() {
				// uni.navigateTo({
				// 	url:"./productionEquipment"
				// })
				let that = this;
				uni.scanCode({
					success: (res)=> {
						console.log(res.result)
						let devID = res.result
						// let devID = '01021481153582433701888'
						that.request(that.$api.getDetail+ devID, {},'GET').then((res) => {
							console.log(1,res)
							if(res.resultValue){
								uni.navigateTo({
									url:"./productionEquipment?devID="+devID
								})
							}
						}).catch((err1) => {
							console.log(2,err1)
						})
					},
					fail: (err) => {
						console.log(3,err)
					}
				});
			}
		}
	}
</script>

<style>
	.box{
		box-sizing: border-box;
		padding: 50rpx;
	}
	.eqBox {
		width: 168rpx;
		text-align: center;
	}

	.scan {
		font-family: PingFangSC-Regular;
		font-weight: Regular;
		font-size: 32rpx;
		color: #414A53;
		text-align: center;
	}
</style>
